﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewsCreate.ascx.cs" Inherits="RealState.W.AdminControl.NewsCreate" %>
<%@ Register Assembly="ASTreeView" Namespace="Geekees.Common.Controls" TagPrefix="ct" %>
<div class="grid_12">
    <div class="box">
        <h2>
            Thêm mới tin tức
        </h2>
        <div class="block">
            <div class="form_place">
                <section class="form_row">
										<div class="grid_2"><label>Tiêu đề:</label></div>
										<div class="grid_10">
											<div class="block_content">
                            <asp:TextBox ID="txtTitle" Width="400px" CssClass="validate[required] text-input" runat="server"></asp:TextBox>
											</div>
										</div>
										<div class="clear"></div>
				</section>

                <section class="form_row">
                    <div class="grid_2">
                        <label>Danh mục:</label>
                    </div>
                    <div class="grid_10">
                        <div class="block_content">
                         <asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
                        </div>
                    </div>
                    <div class="clear"></div>
                </section>
                
                <section class="form_row">
										<div class="grid_10"><label>Tóm tắt:</label></div>
										<br />
										<div class="grid_10" style="width:100%">
											<div class="block_content">
												<asp:TextBox ID="txtIntro" CssClass="validate[required] text-input" runat="server" Height="120px" Width="100%" TextMode="MultiLine"></asp:TextBox>
											</div>
										</div>
										<div class="clear"></div>
				</section>

                <section class="form_row">
										<div class="grid_10"><label>Chi tiết:</label></div>
										<br />
										<div class="grid_10" style="width:100%">
											<div class="block_content">
												<asp:TextBox ID="txtContent" CssClass="validate[required] text-input ckeditor" runat="server" Height="200px" Width="100%" TextMode="MultiLine"></asp:TextBox>
											</div>
										</div>
										<div class="clear"></div>
				</section>
                 <section class="form_row">
										<div class="grid_2"><label>Ảnh đại diện:</label></div>
										<div class="grid_10">
											<div class="block_content">
											
											    <asp:Button ID="btnBindImagesThum" runat="server" Text="Button" style="display:none" onclick="btnBindImagesThum_Click"  />
                                                 <script language="javascript" type="text/javascript">

                                            $(function() {

                                                $('#<%=ddlThumbnail.ClientID %>').change(function() {
                                                    var imgSrc = $(this).val();

                                                    $("#article_img_thumbnail").attr("src", "../upload/news/" + imgSrc);
                                                    $("#article_img_thumbnail").css("display", "inline");

                                                    $("#article_img_thumbnail_modal").attr("title", imgSrc);
                                                    $("#article_img_thumbnail_modal").attr("src", "../upload/news/" + imgSrc);

                                                });

                                                $(function() {

                                                    $('#<%=ddlThumbnail.ClientID %>').change();


                                                    $('#article_img_thumbnail_modal').dialog({ autoOpen: false, resizable: false, draggable: false, modal: true, width: 267, height: 200, title: "Thumbnail" });


                                                    $('#article_img_thumbnail').click(function() {

                                                        $('#article_img_thumbnail_modal').dialog("open");
                                                    });

                                                });

                                           });


                                        </script>

                                                 <script language="javascript" type="text/javascript">
                                            function bindImages() {

                                                var buttonToClick = '<%=btnBindImagesThum.UniqueID %>';
                                                //alert(buttonToClick);

                                                __doPostBack(buttonToClick, "");

                                                //buttonToClick.click();
                                            }
                                        </script>

                                        <iframe src="plugins/UploadImage.aspx?sessionValue=news" width="99%" style="height:120px; display:none" frameborder="0" id="upload-thumbnail-form">
                                        </iframe>


											<table border="0" cellpadding="0" cellspacing="0" class="notable">
                                                <tr>
                                                <td  valign="top" style="vertical-align:top">
                                                    <asp:DropDownList ID="ddlThumbnail" runat="server" CssClass="textbox" Width="250" style="margin-top: 15px;"></asp:DropDownList>        
                                                </td>
                                                <td style="padding-left:10px; vertical-align:top" valign="top">
                                                    <img style="display:none" id="article_img_thumbnail_modal" alt="" />
                                                    <img style="display:none; height:40px; cursor:pointer; border-radius:5px;" id="article_img_thumbnail" alt="" height="40px" title="Click to view image in full size" />
                                                </td>
                                                <td style="padding-left:10px; vertical-align:middle" valign="middle">

                                                <a href="#" onclick="$('#upload-thumbnail-form').dialog('destroy'); $('#upload-thumbnail-form').dialog({resizable: false, draggable: false, modal: true, width: 380, height: 250, title: 'Upload thumbnail' }).width(380).height(250); return false;"><img src="images/upload.png" alt="" title="Upload" /></a>


                                                </td>
                                                </tr>
                                                </table>
											</div>
										</div>
										<div class="clear"></div>
									</section>
                
                <section class="form_row">
										<div class="grid_10">
											<div class="block_content">
													<div class="grid_2"></div>
												
                            <asp:Button ID="btnSave" CssClass="button medium blue" Width="90px" runat="server" Text="Thêm mới" 
                                onclick="btnSave_Click" />
											</div>
										</div>
										<div class="clear"></div>
									</section>
            </div>
        </div>
    </div>
</div>
